package com.xmkj.winmoney.jifen;

import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.util.SparseArray;
import android.view.View;

import com.common.mvp.BaseMvpFragment;
import com.common.mvp.BasePresenter;
import com.xmkj.winmoney.R;
import com.xmkj.winmoney.home.HomePagerAdapter;

/**
 * Create by leo
 * 创建日期：2018/5/3
 * 描述：
 */

public class JiFenFragment extends BaseMvpFragment {
    TabLayout tabLayout ;
    ViewPager viewPager ;
    SparseArray<String> titles = new SparseArray<>();
    @Override
    protected BasePresenter createPresenterInstance() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_jifen;
    }

    @Override
    protected void onViewCreated(View view) {
        tabLayout = view.findViewById(R.id.tab_layout);
        viewPager = view.findViewById(R.id.view_pager);
    }

    @Override
    protected void doLogicFunc() {
        initTab();
    }
    private void initTab() {
        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        titles.append(0, "人气");
        titles.append(1, "最新");
        titles.append(2, "进度");
        titles.append(3, "总需人次");
        viewPager.setAdapter(new JiFenPagerAdapter(getChildFragmentManager(), titles,context));
        tabLayout.setupWithViewPager(viewPager);
    }
}
